<?php
$this->Html->scriptBlock($script, array('inline' => false));
$this->Html->scriptBlock($placementscript, array('inline' => false));
?>
<div class="title-body-content"><?php echo $title_for_layout; ?></div>
<?php
$formUrl = array('controller' => 'paymentschedules', 'action' => 'add');
echo $this->Form->create('Paymentschedule', array('url' => $formUrl, 'type' => 'text'));
?>
<div class="wrapper-content-body clearfix">
    <div class="wrapper-form clearfix">
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span"><?php echo __('Reference#'); ?> :</span>
            <?php
            echo $this->Form->input('Accountresume.Accountresume', array(
                'multiple' => false,
                'empty' => false,
                'class' => 'sel-ref-aih-expense',
                'label' => false,
                'div' => false,)
            );
            ?>
        </div>
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span"><?php echo __('Payment Schedule #'); ?> :</span>
            <?php
            echo $this->Form->input('Paymentschedule.Paymentschedule', array(
                'multiple' => false,
                'empty' => false,
                'class' => 'size-sel1-page4',
                'label' => false,
                'div' => false,)
            );
            ?>
        </div>
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span"><?php echo __('Date'); ?> :</span> 
            <?php echo __('<span id="PaymentscheduleDate">'.date("m/d/Y").'</span>'); ?>
        </div>

        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span">Payer:</span>
            <span id="PaymentschedulePayer"></span>
        </div>
        
        <input type="hidden" id="payername" value="" name="payer_name" />
        <input type="hidden" id="payeename" value="" name="payee_name" />
        <input type="hidden" id="currencyname" value="" name="currency_name" />
        
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span">Account Name:</span>
            <?php
            echo $this->Form->text('account_name', array(
                'class' => 'inp-bank-name',
                'label' => false,
                'div' => false,)
            );
            ?>
        </div>

        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span1"><?php echo __('Payment Desc'); ?> :</span>
            <?php
            echo $this->Form->textarea('payment_desc', array(
                'class' => 'text-area-payment-desc',
                'cols' => 34,
                'rows' => 3,
                'label' => false,
                'div' => false,)
            );
            ?>
        </div>
        
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span">Payee:</span>
            <span id="PaymentschedulePayee">AIH</span>
        </div>
        
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span">Unpaid Amount:</span>
            <input type="text" id="PaymentscheduleAmount" name="data[Paymentschedule][PaymentscheduleAmount]" value="" style="font-weight: bold; text-align: right; padding-right: 2px;" />
            <input type="hidden" id="PaymentscheduleAmount1" name="data[Paymentschedule][PaymentscheduleAmount1]" value="" />
            <span id="PaymentscheduleCurrency"></span>
            <span class="sp-exchange">Exchange :</span>
            <?php
            echo $this->Form->text('exchange', array(
                'class' => 'inp-exchange',
                'label' => false,
                'div' => false,)
            );
            ?>
            <span id="exchangeUSD" style="padding-left: 5px;"></span>
            <select id="exchangeto" name="exchangeto" style="padding-left: 5px;">
                <option value="USD">USD</option>
                <option value="EURO" <?php if($this->data['Paymentschedule']['exchange_to'] == 'EURO'){ echo 'selected';} ?>>EURO</option>
            </select>
            <?php echo $this->Form->checkbox('paid',array('class' => 'chk-paid')); ?>
            <span class="sp-paid">Paid</span>  
            <?php
            echo $this->Form->text('paid_date', array(
                'class' => 'sel-date-paid sel-date',
                'readonly' => 'readonly',
                'label' => false,
                'div' => false,)
            );
            ?>
        </div>
        <div class="wrapper-line-form-payment-schedule clearfix">
            <span class="size-span">Paid Amount:</span>
            <span id="spanpaidamount" class="sp-paid" style="font-weight: bold;"></span>
            <span id="paidamountcurrency">USD</span>
            <input type="hidden" id="paidamount" name="data[Paymentschedule][Paidamount]" value="" />
        </div>
        <div class="wrapper-placement-detail clearfix">
            <span class="title-placement-detail">PLACEMENT DETAILS</span>
            <!-- HTML for placement-detail-title-->
            <div class="left" style="margin-top: 10px; border: 1px solid #DFDDDD; width: 880px; padding: 10px;">
                <div id="placemntloop" class="left" style="width: 450px;">
                    
                </div>
                <div id="toiah" class="left">
                    <div class="clearfix">
                        <span class="sp-place1" style="margin: 0 0 0 20px;">To AIH</span>
                    </div>
                    <span class="sp-payment-aih">$</span>
                    <input type="checkbox" id="chk-payment-to-aih" class="chk-payment-beema" name="chk_payment_aih"><span class="sp-paid">Paid</span>
                    <input type="text" id="paid-aih-placement-date" class="sel-date-paid sel-date" name="paid_aih_placement_date" value="Date" />
                </div>
            </div>
        </div>
    </div>
</div>

<!-- HTML for buttom -form-->

<div class="wrapper-button-form">
    <div class="button-form">
        <div class="button-aihre button-blue"><a href="#" class="save">SAVE</a></div>
        <div class="button-aihre button-blue"><?php echo $this->Html->link(__('CANCEL'), array('plugin' => null, 'controller' => 'paymentschedules', 'action' => 'index')); ?></div>
    </div>
</div>
<?php
echo $this->Form->end();
?>
<?php
$validForm = "
    $(function(){
        $('a.save').click(function(){
            //if($('#PaymentscheduleAccountName').val() == ''){
            //   alert('Account name cannot be left blank');
            //    $('#PaymentscheduleAccountName').focus();
            //}else{
                $('#PaymentscheduleAdminAddForm').submit();
            //}
        });
    });";
$this->Html->scriptBlock($validForm, array('inline' => false));
?>